<{include file="public/header.html"}> 
	<header class="title-fixed w100">
		<div class="title bj-white">
			<a href="/" class="title-top title-left"><img src="<{$style_dir}>/img/logo.png" style="width: 40px;"/></a>
			<div class="login-head title-right">
                        <{if !$uinfo}>
                        <a href="<{eval url('account/login')}>" class="title-right title-btn i-title">登录</a>
                        <{else}>
                        <a href="<{eval url('account')}>" class="i-title head">
                            <img src="<{$uinfo['head_img']}>"/>
                        </a>
                        <{/if}>
			</div>
            <div class="wd-search i-search fr f-cb">
                <input class="fl search-text" id="search-text" type="text" value="<{$search_word}>" readonly="readonly" placeholder="搜索相关问答" data-search-val="<{$keyword}>"/>
                <button class="iconfont search-text">&#xe613;</button>
			</div>
		</div>
	</header>
    <section class="banner-box">
        <div class="index_banner main_visual">
        	<div class="banner-con main_image">
	            <ul>
	                <{foreach from=$banners item=val}>
                        <li>
                            <a href="<{$val['banner_link']}>"><img src="<{$val['banner_img']}>"></a>
                            <{if $val['title']}>
                            <span><{$val['title']}><b></b></span>
                            <{/if}>
                        </li>
                        <{/foreach}>
	            </ul>
                    <a class="btn-prev" id="btn-prev" href="javascript:;"><</a>
	            <a class="btn-next" id="btn-next" href="javascript:;">></a>
        	</div>
            <div class="focus flicking_con">
                <{foreach from=$banners item=val key=key}>
                <a <{if $key == 0}>class="current"<{/if}> href="javascript:;"></a>
                <{/foreach}>
            </div>
        </div>
    </section>
    <!--首页-推荐文章-->
    <section class="index-wraper">
        <div class="recommend-article">
            <{foreach from=$articles item=val key=key}>
            <{if ($key+1)%7 == 0}>
            <section class="nth4" id="list-<{$val['article_id']}>" data-id="<{$val['article_id']}>">
                <a href="<{$val['detail_url']}>" class="article-box"><img src="<{$val['content_thumb']}>" alt="<{$val['title']}>"></a>
                <p class="state4-title textnum25"><{$val['title']}></p>
            </section>
            <{else}>
            <section id="list-<{$val['article_id']}>" data-id="<{$val['article_id']}>">
                <a href="<{$val['detail_url']}>" class="article-box f-cb">
                    <div class="pic fl">
                        <img class="lazy" data-original="<{$val['thumb']}>" alt="<{$val['title']}>">
                    </div>
                    <div class="article-detail">
                        <p class="title"><{$val['title']}></p>
                        <p class="state f-cb">
                            <font class="iconfont fl">&#xe675;</font><span class="fl mr8"><{$val['commentnum']}></span><font class="iconfont fl mr3">&#xe60a;</font><span class="fl"><{$val['readnum']}></span>
                            <i class="fr">
                                <img src="<{$val['head_img']}>" class="mr3" alt="<{$val['nickname']}>">
                                <span><{$val['nickname']}></span>
                            </i>
                        </p>
                    </div>
                </a>
            </section>
            <{/if}>
            <{/foreach}>
        </div>
        <div class="recommend-article" id="content-load-box"></div>
        <div class="loading" id="loading" style="display: none;">
            <!--上拉加载时出现这个图-->
            <a class="/*pull-load*/ load-success" href="javascript:;">加载中...</a>
        </div>
        <div class="loading" id="nomoreresults" style="display: none;">
            <a href="javascript:;" class="load-success">已经到底啦~~~</a>
        </div>
    </section>
    <{include file="public/footer_banner.html"}> 
    <script type="text/javascript" src="/static/js/scrollpagination.js"></script>
    <script type="text/javascript" src="/static/js/jquery.touchSlider.js"></script>
    <script type="text/javascript" src="/static/js/article-min-1.0.js"></script>
    <script type="text/javascript" src="/static/js/common.js"></script>
    <script type="text/javascript">
        var currentPage = 0;
        $('#content-load-box').scrollPagination({
            'contentPage': "/ajax/ajax_more_fetch_arts",
            'contentData': {
                'currentPage': currentPage
            },
            'scrollTarget': $(window),
            'heightOffset': 0,
            'beforeLoad': function() { // before load function, you can display a preloader div
                $('#loading').fadeIn('fast');
                $('#loading').attr('scrollpagination','disabled');
            },
            'afterLoad': function(elementsLoaded) { // after loading content, you can use this function to animate your new elements
                $('#loading').fadeOut('fast');
                $('#loading').attr('scrollpagination','enabled');                           
                if (elementsLoaded.length == 0) {
                    $('#nomoreresults').fadeIn('slow');
                    $('#content-load-box').stopScrollPagination();
                }else{
                    currentPage = currentPage + 1;
                }
                this.contentData.currentPage = currentPage;
                $(elementsLoaded).fadeInWithDelay();
                if ($('#content-load-box').children().length > 100) { // if more than 100 results already loaded, then stop pagination (only for testing)
                    $('#nomoreresults').fadeIn();
                    $('#content-load-box').stopScrollPagination();
                };
            }
	});     
	$.fn.fadeInWithDelay = function() {
            var delay = 0;
            this.each(function() {
                $(this).delay(delay).animate({
                    opacity: 1
                }, 200);
                delay += 100;
            });
            return $("img.lazy").lazyload({
				    effect : "fadeIn",
				    placeholder : "http://static.tan66.com/upfiles/df.jpg"
				});
	};
    $(function(){
        $(".search-text").on("click",function(){
            var _box = $("#search-text"),_text=_box.val();
            window.location.href = "/arts/search.html?kw="+encodeURIComponent(_text);
        });
    });
    </script>
<{include file="public/footer.html"}> 